Skip to content

Conversation

@shivaspeaks
Copy link
Member

@shivaspeaks shivaspeaks commented Oct 27, 2025

Copy link
Contributor

@kannanjgithub kannanjgithub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sending what I could review today.

* Called to deliver a transient error that should not affect the watcher's use of any
* previously received resource.
*
* <p>Note that we expect that the implementer to:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment now applies to both methods since both methods take Status argument now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove it from the method's Javadoc as you have put in the class' Javadoc.

type, resource);
respTimer = null;
onAbsent(null, activeCpc.getServerInfo());
respTimer = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why swap the order of these statements?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code was setting respTimer = null before calling onAbsent(), which caused the timeout context to be lost, resulting in a generic "does not exist" error.

The original for onAbsent method did not have a check for if (respTimer == null). It only looked at the serverInfo.resourceTimerIsTransientError() flag to decide between calling watcher.onError() or watcher.onResourceDoesNotExist(). It could not distinguish between a timeout and other "not found" conditions.

logger.log(XdsLogLevel.WARNING, "No working fallback XDS Servers found from {0}",
activeCpClient.getServerInfo().target());
activeCpc.getServerInfo().target());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes above here seem unnecessary?

executor.execute(() -> {
try {
notifyWatcher(watcher, data);
watcher.onResourceChanged(update); // Call the new method
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the comment as we are passing StatusOr argument.

continue;
}
if (subscriber.hasResult()) {
subscriber.onError(status, null); // This will become an onAmbientError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the handling to call either onDataChanged or onAmbientError happens in ResourceSubscriber.onError, why not simply call it? You are only calling if subscriber.hasResult() is true. What if when it is false? Previously the onError was getting called in that case but not now.

Copy link
Contributor

@kannanjgithub kannanjgithub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comments.

* Called to deliver a transient error that should not affect the watcher's use of any
* previously received resource.
*
* <p>Note that we expect that the implementer to:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove it from the method's Javadoc as you have put in the class' Javadoc.

if (!Objects.equals(oldData, data)) {
for (ResourceWatcher<T> watcher : watchers.keySet()) {
StatusOr<T> update = StatusOr.fromValue(data);
for (Map.Entry<ResourceWatcher<T>, Executor> entry : watchers.entrySet()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change from iterating the keySet to iterating the entrySet? There is nothing wrong with it but it seems like an unnecessary change.
Can keep the executor inlined like before as well.


Status status;
if (respTimer == null) {
status = Status.NOT_FOUND.withDescription("Resource " + resource + " does not exist");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For resource deletions, if fail_on_data_error is false, we should not be setting data = null; and should be calling onAmbientError(NOT_FOUND). lastError should also be set to NOT_FOUND so both the data and the last error are available for replay for new watchers.
Only for fail_on_data_error true we should drop the resource (data = null;) and call onResourceChanged.

for (Map<String, ResourceSubscriber<? extends ResourceUpdate>> subscriberMap :
resourceSubscribers.values()) {
for (ResourceSubscriber<? extends ResourceUpdate> subscriber : subscriberMap.values()) {
if (subscriber.hasResult() || !authoritiesForClosedCpc.contains(subscriber.authority)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove subscriber.hasResult()?

private StatusOr<T> data;
@Nullable
@SuppressWarnings("unused")
private Status ambientError;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be a separate PR for propagating this to the data plane rpc error?

}

if (!pendingRds.isEmpty()) {
// filter chain state has not yet been applied to filterChainSelectorManager and there
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restore this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants